export { defineAxiosExpandConfig, postForm, postJson, postParam, getData, getJson } from "./request"
export { asyncDelay, asyncDelayFactory } from "./asyncDelay"
export type { ResponseResult, AxiosRequestConfigExpand } from "./request"
export type { RequestPageParams, NonNullableFromPick }
export { default as unknowToNumber } from "./unknowToNumber"
export { default as useNewDictData } from "./useNewDictData"

// ts类型合成抽取工具包
type RequestPageParams<T extends Record<string, never> = Record<string, never>> = {
  pageSize?: number
  pageIndex?: number
} & T

// 选择对象的一部分属性变为非空
type NonNullableFromPick<T, K extends keyof T> = Omit<T, K> & {
  [key in K]-?: NonNullable<T[key]>
}

export const aliossImgSizeQuery = (url?: string) => {
  if (!url) return ""
  return url + `${url.includes("?x-oss-process") ? "&" : "?"}x-oss-process=image/resize,m_fill,h_200,w_200`
}
